package com.hotdog.controller;


import com.hotdog.service.ViewAddrService;
import com.hotdog.vo.PageResult;
import com.hotdog.vo.SysResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


/**
 * 用于接收index主页发送的请求并且响应数据
 * 必须包含 sys:res:list 权限可以访问
 *
 * @author 郭鲁政
 */
@RestController
@PreAuthorize("hasAuthority('sys:res:list')")
@RequestMapping("/view")
public class FileController {
    @Autowired
    private ViewAddrService viewAddrService;

    @GetMapping("/getInfo")
    public SysResult getInfo(PageResult pageResult) {
        return SysResult.success(viewAddrService.getAll(pageResult));
    }

    @GetMapping("/history")
    public PageResult getHistory(PageResult pageResult) {
     return    viewAddrService.getHistory(pageResult);
    }
}
